<!DOCTYPE html>
<html class="pixel-ratio-1" style="background-color: #f1f1f1">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
        <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" />
        <meta name="viewport" content="width=375,user-scalabe=no" />
        <meta http-equiv="pragma" content="no-cache" />
        <meta http-equiv="expires" content="0" />
        <script src="../../../../../public/vendor/flexible/flexible.js"></script>
        <title>饲喂记录-新增</title>
        <link rel="stylesheet" type="text/css" href="../../../../../public/vendor/weui/weui.min.css" />
        <link rel="stylesheet" type="text/css" href="../../../../../public/css/common.css" />
        <link rel="stylesheet" type="text/css" href="../../../../../public/css/iconfont/iconfont.css" />
        <link rel="stylesheet" href="../../../../../public/vendor/weui/jquery-weui.css" />
        <link rel="stylesheet" href="../../../../../public/vendor/select2/select2.css" />
        <link rel="stylesheet" href="../../../../../public/themes/base/css/site.css" id="admui-siteStyle" />
        <link rel="stylesheet" href="../../../../../public/css/features/cbs/feeding/addfeeding.css" />

        <script id="addsaleorders-template" type="text/x-template">
            {{~ it :value:index}}
            <div class="report-contents-item-box" id="{{=value.seq}}">
                <div class="weui-cell" style="padding: 15px;">
                     <div class="weui-cell__hd"><label class="weui-label">物料名称</label></div>
                     <div class="weui-cell__bd">
                         <div style="text-align:left">{{=value.material.name}}</div>
                     </div>
                </div>
                <div class="weui-cell" style="padding: 15px;">
                    <div class="weui-cell__hd"><label class="weui-label">物料编码</label></div>
                    <div class="weui-cell__bd">
                        <div style="text-align:left">{{=value.material.numCode}}</div>
                    </div>
                </div>
                 <div class="weui-cell" style="padding: 15px;">
                    <div class="weui-cell__hd"><label class="weui-label">饲喂用量</label></div>
                    <div class="weui-cell__bd">
                        <div style="text-align:left">{{=value.feedingCount}}({{=value.material.baseMeasureUnit=='KG'?'KG':value.material.baseMeasureUnit}})</div>
                    </div>
                </div>
                 <div class="weui-cell plantails" style="display: flex;justify-content: space-around;padding:0px" id="operate{{=value.seq}}">
                    <div style="flex:1;text-align:center;border-right: 1px solid #e6e6e6;padding:10px">
                        <div class="operation-button" data-flag="table-click-delete" data-index='{{=value.seq}}'>
                            <i class="icon iconfont icon-linear-delete icon-font-size-24" style="font-size: 24px;color:#e24f2efd"
                               aria-hidden="true"></i>
                        </div>
                    </div>
                    <div style="flex:1;text-align:center;padding:10px">
                        <div class="operation-button" data-flag="table-click-edit" data-index='{{=value.seq}}'>
                            <i class="icon iconfont icon-edit-no-border icon-font-size-24" style="font-size: 24px;color:#fe8636fd"
                               aria-hidden="true"></i>
                        </div>
                    </div>
                </div>
            </div>
            {{~}}
        </script>
        <script type="text/javascript">
            window._AMapSecurityConfig = {
                securityJsCode: 'f46d50ca281e635de73435eb860cfbbf',
            };
        </script>
        <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.14&key=657d628d60d09241b068d846b9113dae"></script>
        <script type="text/javascript" src="../../../../../public/js/common/addToolbar.js"></script>
    </head>

    <body>
        <div id="main-addsaleorders">
            <form id="addsaleorders-form">
                <div class="weui-cells__group weui-cells__group_form">
                    <p class="saleOrders-message">饲喂记录信息</p>
                    <div class="report-contents-item-box">
                        <div class="weui-cell weui-cell_select" style="padding: 15px" id="search-date">
                            <div class="weui-cell__hd stycon">
                                <label class="weui-label">
                                    业务日期
                                    <span class="red-900">&nbsp;*</span>
                                </label>
                            </div>
                            <div class="weui-cell__bd">
                                <input class="weui-input clearContent masterpad" type="text" id="businessTime" placeholder="请选择业务日期..." required emptyTips="请选择业务日期" v-model="bizDate" readonly />
                            </div>
                        </div>

                        <div class="weui-cell weui-cell_select" style="padding: 15px">
                            <div class="weui-cell_orgs" style="display: -webkit-flex; align-items: center">
                                <span class="weui-cell__hd stycon selcon" style="padding-right: 10px">
                                    <span>
                                        养殖批次
                                        <span class="red-900" style="position: absolute">&nbsp;*</span>
                                    </span>
                                </span>
                                <span class="weui-cell__ft">
                                    <select class="weui-select clearContent" id="breedBatch" style="visibility: hidden" required></select>
                                    <input type="hidden" id="veridbreedbatchs" value="" />
                                </span>
                            </div>
                        </div>

                        <!-- <div class="weui-cell weui-cell_select" style="padding: 15px;">
                        <div class="weui-cell_orgs" style="display: -webkit-flex;align-items: center;">
                            <span class="weui-cell__hd stycon selcon" style="padding-right: 10px">
                                <span>公司<span class="red-900" style="position:absolute;">&nbsp;*</span></span>
                            </span>
                            <span class="weui-cell__ft">
                                <select class="weui-select clearContent " id="fiOrg" style="visibility: hidden;"
                                    required>
                                </select>
                            </span>
                        </div>
                    </div> -->

                        <!-- <div class="weui-cell weui-cell_select" style="padding: 15px;">
                        <div class="weui-cell_orgs" style="display: -webkit-flex;align-items: center;">
                            <span class="weui-cell__hd stycon selcon" style="padding-right: 10px">
                                <span>服务部<span class="red-900" style="position:absolute;">&nbsp;*</span></span>
                            </span>
                            <span class="weui-cell__ft">
                                <select class="weui-select clearContent " id="farmOrg" style="visibility: hidden;"
                                    required>
                                </select>
                            </span>
                        </div>
                    </div> -->

                        <div class="weui-cell" style="padding: 15px">
                            <div class="weui-cell__hd"><label class="weui-label">公司</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input clearContent masterpad" type="text" placeholder="选择养殖批次后带出..." v-model="fiOrg.name" disabled />
                            </div>
                        </div>
                        <div class="weui-cell" style="padding: 15px">
                            <div class="weui-cell__hd"><label class="weui-label">服务部</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input clearContent masterpad" type="text" placeholder="选择养殖批次后带出..." v-model="farmOrg.name" disabled />
                            </div>
                        </div>

                        <div class="weui-cell" style="padding: 15px">
                            <div class="weui-cell__hd"><label class="weui-label">存栏数量(头)</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input clearContent masterpad" type="text" placeholder="选择养殖批次后带出..." v-model="Utils.toThousands(curQty, 0)" disabled />
                            </div>
                        </div>
                        <div class="weui-cell" style="padding: 15px">
                            <div class="weui-cell__hd"><label class="weui-label">饲喂日龄(天)</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input clearContent masterpad" type="text" placeholder="选择养殖批次后带出..." v-model="curDays" disabled />
                            </div>
                        </div>
                        <div class="weui-cell weui-cell_select" style="padding: 15px">
                            <div class="weui-cell_orgs" style="display: -webkit-flex; align-items: center">
                                <span class="weui-cell__hd stycon selcon" style="padding-right: 10px">
                                    <span>
                                        猪只品种
                                        <span class="red-900" style="position: absolute">&nbsp;*</span>
                                    </span>
                                </span>
                                <span class="weui-cell__ft">
                                    <select class="weui-select clearContent" id="breed" style="visibility: hidden" required></select>
                                </span>
                            </div>
                        </div>
                        <div class="weui-cell" style="padding: 15px">
                            <div class="weui-cell__hd"><label class="weui-label">标准用量（kg）</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input clearContent masterpad" type="text" v-model="feedAmount" hidden />
                                <input class="weui-input clearContent masterpad" type="text" placeholder="根据日龄带出..." v-model="feedStandards" disabled />
                            </div>
                        </div>
                        <div class="weui-cell" style="padding: 15px">
                            <div class="weui-cell__hd"><label class="weui-label">备注</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input clearContent masterpad" type="text" id="remark" placeholder="请输入备注..." v-model="remark" />
                            </div>
                        </div>
                        <div class="weui-cell" style="padding: 0px"></div>
                        <div class="weui-cells-border weui-cells_form" id="uploader">
                            <div class="weui-cell" style="padding: 16px">
                                <div class="weui-cell__bd">
                                    <div class="weui-uploader">
                                        <div class="weui-uploader__hd">
                                            <p class="weui-uploader__title" style="text-align: left">附件</p>
                                            <div class="weui-uploader__info">
                                                <span id="uploadCount">{{uploadCount}}</span>
                                                /3
                                            </div>
                                        </div>
                                        <div class="weui-uploader__bd">
                                            <ul class="weui-uploader__files" id="uploaderFiles"></ul>
                                            <div class="weui-uploader__input-box">
                                                <input id="uploaderInput" class="weui-uploader__input" type="file" accept="image/*" capture="camera" />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <p class="saleOrders-message" style="margin-bottom: 0">饲喂记录分录列表</p>

                <a href="javascript:;" class="weui-btn weui-btn_primary" id="add-saleEntry">新增</a>

                <div id="salesEntry" style="margin-top: 20px"></div>
                <div id="saleplansList"></div>
                <div class="report-contents-item-box operation">
                    <div class="weui-cell operation-child">
                        <a href="javascript:;" class="weui-btn weui-btn_default" style="width: 38%; border-radius: 8px; background-color: #fff; margin-left: 0px" id="returnMain">取消</a>
                        <a href="javascript:;" class="weui-btn weui-btn_primary" style="width: 60%; border-radius: 8px; margin-top: 0px; margin-right: 0px" id="informationSubmit">保存</a>
                    </div>
                </div>
                <div style="height: 1px"></div>
            </form>
        </div>

        <!--底部弹出框-->
        <div id="pop"></div>
        <div class="show-box" style="display: none">
            <div class="title">
                <div class="tit">选择销售计划列表</div>
            </div>
            <hr />
            <div id="saleplans-list" style="overflow: auto; height: 100%"></div>
            <div class="report-contents-item-box" style="background-color: white; border: none; position: fixed; bottom: 0px; width: 100%">
                <div class="weui-cell bottom_btn" id="button-height" style="display: flex; justify-content: space-between; padding: 0px; margin-right: 20px; height: 90px">
                    <a href="javascript:;" class="weui-btn weui-btn_default" style="width: 40%; border-radius: 8px; margin-top: 10px; margin-left: -10px" id="returnAddSaleOrders">取消</a>
                    <a href="javascript:;" class="weui-btn weui-btn_primary" style="width: 55%; border-radius: 8px; margin-top: 10px" id="saleplansSubmit">确定</a>
                </div>
            </div>
        </div>

        <!-- 获取定位 -->
        <div id="addressInfo" style="display: none"></div>
        <!-- 加载远程定位脚本 -->
        <script type="text/javascript" src="https://a.amap.com/jsapi_demos/static/remogeo/remogeo.js"></script>
        <script type="text/javascript">
            var map, geolocation;
            //加载地图，调用浏览器定位服务
            map = new AMap.Map('container', {
                resizeEnable: true,
            });

            map.plugin('AMap.Geolocation', function () {
                geolocation = new AMap.Geolocation({
                    enableHighAccuracy: true, //是否使用高精度定位，默认:true
                    timeout: 10000, //超过10秒后停止定位，默认：无穷大
                    maximumAge: 0, //定位结果缓存0毫秒，默认：0
                    convert: true, //自动偏移坐标，偏移后的坐标为高德坐标，默认：true
                    showButton: true, //显示定位按钮，默认：true
                    buttonPosition: 'LB', //定位按钮停靠位置，默认：'LB'，左下角
                    buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)
                    showMarker: true, //定位成功后在定位到的位置显示点标记，默认：true
                    showCircle: true, //定位成功后用圆圈表示定位精度范围，默认：true
                    panToLocation: true, //定位成功后将定位到的位置作为地图中心点，默认：true
                    zoomToAccuracy: true, //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
                });

                // ios环境切换到使用远程https定位
                if (AMap.UA.ios && document.location.protocol !== 'https:') {
                    //使用远程定位，见 remogeo.js
                    var remoGeo = new RemoGeoLocation();

                    //替换方法
                    navigator.geolocation.getCurrentPosition = function () {
                        return remoGeo.getCurrentPosition.apply(remoGeo, arguments);
                    };

                    //替换方法
                    navigator.geolocation.watchPosition = function () {
                        return remoGeo.watchPosition.apply(remoGeo, arguments);
                    };
                }

                map.addControl(geolocation);
                geolocation.getCurrentPosition();
                AMap.event.addListener(geolocation, 'complete', onComplete); //返回定位信息
                AMap.event.addListener(geolocation, 'error', onError); //返回定位出错信息
            });
            //解析定位结果
            function onComplete(data) {
                let locationLng = data.position.getLng();
                let locationLat = data.position.getLat();
                getJingweiduLocation(locationLng, locationLat);
            }
            //解析定位错误信息
            function onError(data) {
                $('#addressInfo').text('');
            }
            function getJingweiduLocation(long, lat) {
                if (long && lat) {
                    let that = this;
                    AMap.plugin('AMap.Geocoder', function () {
                        var geocoder = new AMap.Geocoder({});
                        var lnglat = [long, lat];
                        geocoder.getAddress(lnglat, function (status, result) {
                            if (status === 'complete' && result.info === 'OK') {
                                $('#addressInfo').text(result.regeocode.formattedAddress);
                            } else {
                                $('#addressInfo').text('');
                            }
                        });
                    });
                } else {
                    $('#addressInfo').text('');
                }
            }
        </script>

        <script type="text/javascript" src="../../../../../public/vendor/jquery/jquery.min.js"></script>
        <script type="text/javascript" src="../../../../../public/vendor/weui/jquery-weui.js"></script>
        <script type="text/javascript" src="../../../../../public/vendor/vue/vue.min.js"></script>
        <script type="text/javascript" src="../../../../../public/vendor/moment/moment.min.js"></script>
        <script type="text/javascript" src="../../../../../public/vendor/weui/weui.js"></script>
        <script type="text/javascript" src="../../../../../public/vendor/weui/jquery-weui.min.js"></script>
        <script type="text/javascript" src="../../../../../public/js/common/iosadaptation.js"></script>
        <script type="text/javascript" src="../../../../../public/js/config/utils.js"></script>
        <script type="text/javascript" src="../../../../../public/vendor/select2/select2.full.min.js"></script>
        <script type="text/javascript" src="../../../../../public/vendor/select2/i18n/zh-CN.js"></script>
        <script type="text/javascript" src="../../../../../public/vendor/form-entries/form-entries.js"></script>
        <script src="https://webapi.amap.com/ui/1.0/main.js"></script>
        <script type="module" src="../../../../../public/js/features/cbs/feeding/addfeeding.js"></script>
    </body>
</html>
